package com.UI;

import com.Model.StudentDBModel;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.Toast;

public class GoToStudentWebmail extends Activity{
	public void onCreate(Bundle savedInstanceState) {		
		super.onCreate(savedInstanceState);

		setContentView(R.layout.goto_student_webmail);
		
		// create a model instance
		StudentDBModel newWebmail = new StudentDBModel(this);
		
		Context context = getApplicationContext();   
		String url = newWebmail.getWebmailUrl();   
		Intent webMailGo = new Intent(Intent.ACTION_VIEW);   
		Uri webMailURL = Uri.parse(url);   
		webMailGo.setData(webMailURL);   
		try {   
		  // Start the activity   
		  startActivity(webMailGo);   
		} catch (ActivityNotFoundException e) {   
		  // Raise on activity not found   
		  Toast noBrowser = Toast.makeText(context, "Browser not found.", Toast.LENGTH_SHORT);   
		  noBrowser.show();
		} 
	}
	
    @Override
    protected void onPause() {
        super.onPause();
    }
    
    @Override
    protected void onResume() {
        super.onResume();
        GoToStudentWebmail.this.finish();
    }
}
